package com.aktiehuis.bean;

import java.io.Serializable;

import javax.ejb.EJB;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.aktiehuis.main.Categorie;
import com.aktiehuis.main.Product;
import com.aktiehuis.main.Winkel;

@Table(name="producten_winkel")
@Entity
public class ProductBean implements Product, Serializable {
	private static final long serialVersionUID = -6114055528216320026L;
	@Id @GeneratedValue private int id = 0;
	private String naam = null;
	@ManyToOne(targetEntity=WinkelBean.class, fetch=FetchType.EAGER)
	@JoinColumn(name="winkel_id")
	@EJB private Winkel winkel = null;
	@ManyToOne(targetEntity=CategorieBean.class, fetch=FetchType.EAGER)
	@JoinColumn(name="categorie_id")
	@EJB private Categorie categorie = null;
	
	public ProductBean() {
		id = 0;
		naam = null;
		winkel = null;
		categorie = null;
	}
	
	public ProductBean( int newId, String newNaam, Winkel newWinkel, Categorie newCategorie ) {
		id = newId;
		naam = newNaam;
		winkel = newWinkel;
		categorie = newCategorie;
	}
	
	public int getId() {
		return id;
	}
	
	public String getNaam() {
		return naam;
	}
	
	public Winkel getWinkel() {
		return winkel;
	}
	
	public Categorie getCategorie() {
		return categorie;
	}
}
